home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16790 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: news.lpr.carel.fi!usenet
  2. From: Ari Lukumies <aril@cmt.lpr.mail.carel.fi>
  3. Newsgroups: comp.os.ms-windows.programmer.tools.owl,comp.lang.c++
  4. Subject: Re: Creating a console window
  5. Date: Fri, 12 Apr 1996 12:59:26 +0300
  6. Organization: Carelcomp Products
  7. Message-ID: <316E297E.463C@cmt.lpr.mail.carel.fi>
  8. References: <316C4760.4C@interaccess.com>
  9. NNTP-Posting-Host: renoir.cclahti.carel.fi
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0 (WinNT; I)
  14.  
  15. Thaddeus L. Olczyk wrote:
  16. > Does anyone know how I can open a console window in a Win95 GUI app?
  17. > I want to dump some data for debugging purposes.
  18. > Richter's Advanced Windows says that it is possible, but does not say how, and
  19. > I have not been able to find a description anywhere else.
  20.  
  21. Check out the API AllocConsole. If you want to make use of stdout (for printf 
  22. etc), you can then use something like this:
  23.  
  24.     HANDLE    hStdout;
  25.     FILE    *fp;
  26.  
  27.     hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
  28.     *fp = _fdopen(_open_osfhandle(hStdout, _O_TEXT), "w");
  29.     *stdout = *fp;
  30.     printf("Hello!\n");
  31.  
  32. Later,
  33.  AriL
  34. -- 
  35. All my opinions are mine and mine alone.
  36.